package com.bw.demo.flowstatistic.demo04;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class GroupBean implements Writable {
	private long up;
	protected long down;
	private long sum;
	
	public GroupBean() {
		super();
	}

	public GroupBean(long up, long down) {
		super();
		this.up = up;
		this.down = down;
		this.sum = this.up+this.down;
	}
	
	public long getUp() {
		return up;
	}

	public void setUp(long up) {
		this.up = up;
	}

	public long getDown() {
		return down;
	}

	public void setDown(long down) {
		this.down = down;
	}

	public long getSum() {
		return sum;
	}

	public void setSum(long sum) {
		this.sum = sum;
	}

	@Override
	public void readFields(DataInput input) throws IOException {
		// TODO Auto-generated method stub
		this.up = input.readLong();
		this.down = input.readLong();
		this.sum = input.readLong();
	}

	@Override
	public void write(DataOutput output) throws IOException {
		// TODO Auto-generated method stub
		output.writeLong(up);
		output.writeLong(down);
		output.writeLong(sum);
	}


	@Override
	public String toString() {
		return up + "\t" + down + "\t" + sum ;
	}
	
}
